package Demo5;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-12-19
 * Time: 21:35
 */

import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        int n, t;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        System.out.println("斐波纳契数列如下：");
        for (int i = 0; i <= n; i++) {
            t = fbnq(i);
            System.out.print(t + " ");
        }
    }

    public static int fbnq(int n) {
        if (n == 1 || n == 0) {
            return 1;
        } else if (n >= 2) {
            return fbnq(n - 1) + fbnq(n - 2);
        } else {
            return 1;
        }
    }
}

